package list;

public class test2 {
    public static void main(String[] args) {
        int[] arr = { 1, 2, 3, 4, 5 };
        for (int i = 1; i < arr.length; i++) {
            arr[i] = arr[i] + arr[i - 1];
        }
        for (int i : arr) {
            System.out.print(i + " ");
        }
    }
    public static int[] ArrSum(int[] arr) {
        for (int i = 0; i < arr.length; i++) {
            if (i == 0) {
                continue;
            }
            arr[i] = arr[i] + arr[i - 1];
        }
        return arr;
    }
}
